﻿#ifndef NETWORKINFO_H
#define NETWORKINFO_H

#include <QBaseEntity>
#include <QByteArray>

class NetworkInfo : public QBaseEntity
{
    Q_OBJECT
    // 定义属性
    Q_PROPERTY(QString name READ getName WRITE setName)
    Q_PROPERTY(QString description READ getDescription WRITE setDescription)
    Q_PROPERTY(quint32 index READ getIndex WRITE setIndex)
    Q_PROPERTY(quint32 type READ getType WRITE setType)
    Q_PROPERTY(quint64 mtu READ getMtu WRITE setMtu)
    Q_PROPERTY(QString macAddress READ getMacAddress WRITE setMacAddress)
    Q_PROPERTY(quint64 speed READ getSpeed WRITE setSpeed)
    Q_PROPERTY(bool isAdminUp READ isAdminUp WRITE setAdminUp)
    Q_PROPERTY(QString operationalStatus READ getOperationalStatus WRITE setOperationalStatus)

public:
    explicit NetworkInfo(QObject *parent = nullptr);

    QString getName() const;
    void setName(const QString &value);

    QString getDescription() const;
    void setDescription(const QString &value);

    quint32 getIndex() const;
    void setIndex(quint32 value);

    quint32 getType() const;
    void setType(quint32 value);

    quint64 getMtu() const;
    void setMtu(quint64 value);

    QString getMacAddress() const;
    void setMacAddress(const QString &value);

    quint64 getSpeed() const;
    void setSpeed(quint64 value);

    bool isAdminUp() const;
    void setAdminUp(bool value);

    QString getOperationalStatus() const;
    void setOperationalStatus(const QString &value);

private:
    QString name;                  // 网卡名称
    QString description;           // 网卡描述
    quint32 index = 0;             // 接口索引
    quint32 type = 0;              // 接口类型
    quint64 mtu = 0;               // 最大传输单元 (MTU)
    QString macAddress;            // MAC 地址（字符串形式，如"AA:BB:CC:DD:EE:FF"）
    quint64 speed = 0;             // 网卡速度（bps）
    bool m_adminUp = false;        // 管理状态（启用/禁用）
    QString operationalStatus;     // 操作状态（字符串形式）
};

#endif // NETWORKINFO_H
